<?php
/**
 * Created by PhpStorm.
 * User: readLine
 * Date: 2017/12/4
 * Time: 10:36
 */

namespace app\portal\controller;


use cmf\controller\HomeBaseController;
use think\Db;

class MessageController extends HomeBaseController
{
    public function index(){

        $list = Db::table('cmf_message')->select();

        $this->assign('list',$list);

        return $this->fetch('/message');
    }

    public function inputMsg(){


        $data['name'] = input('name');
        $data['content'] = input('content');
        $data['date'] = date('Y-m-d');

        $res = Db::table('cmf_message')->insert($data);
        if($res){
            $this->success('成功插入');
        }
        else{
            $this->error('插入失败');
        }
    }

}